<extend name="./Base/base" />

<block name="main">
	<div class="row">
		<div class="panel">
			<div class="panel-heading bk-bg-primary">
				<h6><i class="fa fa-table red"></i><span class="break"></span>分类列表</h6>							
				<div class="panel-actions">								
					<a href="table.html#" class="btn-setting"><i class="fa fa-rotate-right"></i></a>
					<a href="table.html#" class="btn-minimize"><i class="fa fa-chevron-up"></i></a>
					<a href="table.html#" class="btn-close"><i class="fa fa-times"></i></a>
				</div>
			</div>
			<div class="panel-body">
				<div class="table-responsive">
					<table class="table">
						  <thead>
							<tr>
							  <th>用户ID</th>
							  <th>用户名称</th>
							  <th>邮箱</th>
							  <th>登录时间</th>
							  <th>状态</th>
							  <th>操作</th>
							</tr>
						  </thead> 
						    
						<tbody>
							<foreach name="list" item="vo">
							  <tr>
									<td>{$vo.id}</td>
									<td>{$vo.username}</td>
									<td>{$vo.email}</td>
									<td>{$vo.update_at|date='Y-m-d H:i:s',###}</td>
									<if condition=" $vo.status eq 1 ">
										<td>
											<a href="javascript:userstatus({$vo.id});"><span class="btn btn-warning">正常</span></a>
										</td>
									<else /> 
										<td>
											<a href="javascript:userstatus({$vo.id});"><span class="btn btn-danger">禁用</span></a>
										</td>
									</if>
									
									<td>
										
										<a class="btn btn-info" href="{:U('User/user_edit','id='.$vo['id'])}"  >
											<i class="fa fa-edit "></i>                                            
										</a>
										<a class="btn btn-danger" href="javascript:delete_order({$vo.id});" >
											<i class="fa fa-trash-o "></i> 

										</a>
									</td>
								</tr>
							</foreach>									                                  
						</tbody>
					</table>
				</div>
				 <div class="green-black">{$page}</div>
			</div>
		</div>
	</div>
</block>
<block name="script_user">
	<script type="text/javascript">
	function delete_order(id){
		var id = id;
		$.get("{:U('User/user_delete')}",{id:id},function(data){
			if(data == 1){
				window.location.reload();
			}
		});
	}

	function userstatus(id){
		var id = id;
		// alert(id);
		$.get("{:U('User/user_status')}",{id:id},function(data){
			if (data == 1) {
				location.href = "{:U('User/index')}";
			}else if(data == 2){
				location.href = "{:U('User/index')}";
			}
		});
	}
	</script>
</block>